<?xml version="1.0"?>
<OnTheFlyInstruction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <InstanceId>OnTheFlyInstruction_41</InstanceId>
  <CustomAppConfig />
  <Tags>
    <string>SharePoint</string>
  </Tags>
  <AdditionalAssemblies />
  <Code><![CDATA[using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.Xml.Serialization;
using xSolon.Instructions;
using xsol.SPServices.Instructions;

namespace xSol.Samples
{
    /// <summary>
    /// Process all site collections in a web application ( sync )
    /// </summary>
    public class WebAppSample : WebAppInstruction
    {
        public WebAppSample()
        {
            OnProcessSite += WebAppSample_OnProcessSite;
            WebAppUrl = "http://localhost";
        }

		private static SPWeb web = null;
		
		private static object MyLock = new object();
		
        void WebAppSample_OnProcessSite(SPSite site)
        {

			if (StopPending || web != null) return;
		
			lock(MyLock)
			{
				
				if (StopPending || web != null) return;

				StopPending = true;
				
				web = site.OpenWeb();
				
				NotifyInformation(web.Title);
				
				Inspect(web, "");
				
				web.Update();
				
				NotifyInformation(web.Title);
				
			}
			
        }
    }
}]]></Code>
</OnTheFlyInstruction>